package online.flytool.base.unsafe;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Path;
import java.util.Properties;

/**
 * @author ：lingchong
 * @date ：Created in 2022/7/3 18:32
 * @description：简单的文件工厂,创建各种和文件相关的对象
 * @modified By：
 * @version: $
 */
public class EasyFileFactory {

    public static Properties createProperties(String pathStr){
        try(InputStream is=new FileInputStream(pathStr);) {
            SafeProperties safeProperties=new SafeProperties();
            safeProperties.load(is);
            return safeProperties;
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

}